package no.sachmuld.methodcombination.examples.annotation.clossimplestyle.equalshashcode.v2;

import java.util.Arrays;
import java.util.List;

/**

 *
 */
public class Point3D extends Point2D {

    private int z;

    public Point3D(int x, int y, final int z) {

        super(x, y);
        this.z = z;

        with(new PointBehaviour() {

            @Override
            public List<Integer> hashCodes() {
                return Arrays.asList(z);
            }

            @Override
            public boolean equals(Object obj) {
                if (Point3D.this == obj) return true;
                if (obj == null || Point3D.this.getClass() != obj.getClass()) return false;

                Point3D other = (Point3D) obj;

                if (z != other.z) return false;

                return true;
            }

        });

    }
}